#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install -y ssh-client
sudo apt-get upgrade -y git

git --version

mkdir -p ~/.ssh
chmod 700 ~/.ssh


touch ~/.ssh/known_hosts
keyscan(){
if ! grep $1 ~/.ssh/known_hosts > /dev/null
then
ssh-keyscan $1 >> ~/.ssh/known_hosts
fi
}
keyscan github.com
keyscan code.aliyun.com


SSH_KEY=~/.ssh/git
echo -----BEGIN OPENSSH PRIVATE KEY----- > $SSH_KEY
echo ${ED25519//[[:blank:]]/} >> $SSH_KEY
echo -----END OPENSSH PRIVATE KEY----- >> $SSH_KEY
chmod 400 $SSH_KEY

cat $SSH_KEY

cd ..
mkdir -p 6du
cd 6du

export GIT_SSH_COMMAND="ssh -i $SSH_KEY"

git clone git@code.aliyun.com:6du.space/font.git --depth=1
